from pydantic_settings import BaseSettings
from typing import Dict, Any, List, Optional, Union
import os

class Config(BaseSettings):
    # Flask配置
    FLASK_APP: Optional[str] = None
    FLASK_ENV: Optional[str] = None
    FLASK_DEBUG: Optional[bool] = None
    
    # 应用配置
    DEBUG: bool = False
    SECRET_KEY: str = "your-secret-key"  # 需要替换为实际的密钥
    CORS_ORIGINS: List[str] = ["*"]
    
    # 缓存配置
    CACHE_TYPE: str = "simple"
    CACHE_DEFAULT_TIMEOUT: int = 300
    
    class Config:
        env_file = ".env"
        case_sensitive = True
        extra = "allow"  # 允许额外的字段

class DevelopmentConfig(Config):
    DEBUG: bool = True
    # 开发环境特定配置...

    # 数据库配置
    MYSQL_HOST: str = '127.0.0.1'
    MYSQL_PORT: int = 3306
    MYSQL_USER: str = 'root'
    MYSQL_PASSWORD: str = '123456'
    MYSQL_DB: str = 'tds_standard'

    # API配置
    API_BASE_URL: str = "http://api.example.com"  # 需要替换为实际的API地址
    API_TIMEOUT: int = 30

class ProductionConfig(Config):
    DEBUG: bool = False
    # 生产环境特定配置...

    # 数据库配置
    MYSQL_HOST: str = 'production-db-host'
    MYSQL_PORT: int = 3306
    MYSQL_USER: str = 'prod-user'
    MYSQL_PASSWORD: str = 'prod-password'
    MYSQL_DB: str = 'tds_standard'

    # API配置
    API_BASE_URL: str = "https://api.production.com"
    API_TIMEOUT: int = 30

# 默认使用开发环境配置
settings = DevelopmentConfig() 